import React, { useState, useEffect } from "react";

function App() {
  const [data, setData] = useState("initialState");
  useEffect(() => {
    let p = new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve("promise执行了");
      }, 3000);
    }).then((res) => {
      console.log("then:", res);
    });
  }, []);
  return <div>{data}</div>;
}

export default App
